/**
 * amis v2.4.0
 * Copyright 2018-2022 baidu
 */

import { __extends, __decorate } from 'tslib';
import React from 'react';
import { getPropValue, filter, Renderer } from 'amis-core';

var Plain = /** @class */ (function (_super) {
    __extends(Plain, _super);
    function Plain() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Plain.prototype.render = function () {
        var _a = this.props, className = _a.className, wrapperComponent = _a.wrapperComponent, text = _a.text, data = _a.data, tpl = _a.tpl, inline = _a.inline, placeholder = _a.placeholder, cx = _a.classnames;
        var value = getPropValue(this.props);
        var Component = wrapperComponent || (inline ? 'span' : 'div');
        return (React.createElement(Component, { className: cx('PlainField', className) }, tpl || text ? (filter(tpl || text, data)) : typeof value === 'undefined' || value === '' || value === null ? (React.createElement("span", { className: "text-muted" }, placeholder)) : (String(value))));
    };
    Plain.defaultProps = {
        wrapperComponent: '',
        inline: true,
        placeholder: '-'
    };
    return Plain;
}(React.Component));
/** @class */ ((function (_super) {
    __extends(PlainRenderer, _super);
    function PlainRenderer() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PlainRenderer = __decorate([
        Renderer({
            test: /(^|\/)(?:plain|text)$/,
            name: 'plain'
        })
    ], PlainRenderer);
    return PlainRenderer;
})(Plain));

export { Plain };
